#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    int singleNumber(vector<int>& nums) {
        vector<int> bitCourt(32, 0);
        int mask = 1;
        for (auto e : nums) {
            for (int i = 0; i < 32; i++) {
                if (e & (1 << i))
                    bitCourt[i]++;
            }
        }
        int ret = 0;
        for (int i = 0; i < 32; i++) {
            if (bitCourt[i] % 3 != 0) {
                ret |= (1 << i);
            }
        }
        return ret;

    }
};